import request from '@/utils/request'

// 注册请求
export function regAPI(body) {
  return request.post('/api/reg', body)
}

// 登录请求
export const loginAPI = obj => {
  return request.post('/api/login', obj)
}

// 获取用户信息
export const getUserAPI = () => {
  return request.get('/my/userinfo')
}

// 更新用户数据
export const updayeUserAPI = data => {
  return request.put('/my/userinfo', data)
}

// 重置密码
export const updatePwdAPI = data => request.patch('/my/updatepwd', data)

// 更换头像
export const updateAvatarAPI = str => {
  return request.patch('/my/update/avatar', { avatar: str })
}
// 封装添加分类的请求
export const addCategoryAPI = data => {
  return request.post('/my/cate/add', data)
}

// 获取文章数据列表
export const getArticleAPI = obj => request.get('/my/article/list', { params: obj })
